home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / LANG / C / GCC / V2-4-5 / GPPLIBSR00 / cc / iomanip < prev    next >
Text File  |  1993-12-08  |  2KB  |  78 lines

  1. //    -*- C++ -*- 
  2. //    This is part of the iostream library, providing parametrized manipulators
  3. //    Written by Heinz G. Seidl, Copyright (C) 1992 Cygnus Support
  4. //
  5. //    This library is free software; you can redistribute it and/or
  6. //    modify it under the terms of the GNU Library General Public
  7. //    License as published by the Free Software Foundation; either
  8. //    version 2 of the License, or (at your option) any later version.
  9. //
  10. //    This library is distributed in the hope that it will be useful,
  11. //    but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13. //    Library General Public License for more details.
  14. //
  15. //    You should have received a copy of the GNU Library General Public
  16. //    License along with this library; if not, write to the Free
  17. //    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18.  
  19. #ifdef __GNUG__
  20. #pragma implementation "iomanip.h"
  21. #endif
  22.  
  23. #include "iomanip.h"
  24.  
  25.  
  26. // Those functions are called through a pointer, 
  27. // thus it does not make sense, to inline them.
  28.  
  29. ios & __iomanip_setbase (ios& i, int n)
  30. {
  31.     ios::fmtflags b;
  32.     switch (n)
  33.       {
  34.     case  8: 
  35.       b = ios::oct; break;
  36.     case 10: 
  37.       b = ios::dec; break;
  38.     case 16: 
  39.       b = ios::hex; break;
  40.     default:
  41.       b = 0;
  42.       }
  43.     i.setf(b, ios::basefield);
  44.     return i;
  45. }
  46.  
  47. ios & __iomanip_setfill (ios& i, int n)
  48. {
  49.     //FIXME if ( i.flags() & ios::widechar )
  50.       i.fill( (char) n);
  51.     //FIXME else
  52.     //FIXME   i.fill( (wchar) n);
  53.     return i;
  54. }   
  55.  
  56. ios &  __iomanip_setprecision (ios& i, int n)
  57. {
  58.     i.precision(n);
  59.     return i;
  60. }
  61. ios &  __iomanip_setw (ios& i, int n)
  62. {
  63.     i.width(n);
  64.     return i;
  65. }
  66.  
  67. ios & __iomanip_setiosflags (ios& i, ios::fmtflags n)
  68. {
  69.     i.setf(n,n);
  70.     return i;
  71. }
  72.  
  73. ios & __iomanip_resetiosflags (ios& i, ios::fmtflags n)
  74. {
  75.     i.setf(0,n);
  76.     return i;
  77. }
  78.